/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.mop.dinnerbook.dao;

import com.mop.dinnerbook.bean.Menu;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *菜谱操作业务类
 * @author Huge Laurie
 */
public class MenuDAO extends BaseDAO{
    /*
     获取菜谱
     */
    public Menu getMenu(){
        Menu result = null;
        String sql="select content from menu";
        try {
			result = (Menu)executeSelectObject(sql, new Processor(){
				public Object product(ResultSet rst) throws SQLException{
					Menu menu = new Menu();
					menu.setContent(rst.getString(1));
					return menu;
				}
			});
		} catch (SQLException e) {
                        System.out.println(sql);
			e.printStackTrace();
		}
        return result;
    }
    
    public boolean modifyMenu(Menu menu){
        boolean result = false;
        System.out.println(menu.getContent());
        String sql="update menu set content='" + menu.getContent() + "'";
        try {
		result = executeUpdate(sql) > 0;	
	} catch (SQLException e) {
                System.out.println(sql);
		e.printStackTrace();
	}
        return result;
    }
}
